package com.zxb.user.demo;

import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.NamingFactory;
import com.alibaba.nacos.api.naming.NamingService;

import java.util.Properties;

public class NamingExample {

    public static void main(String[] args) throws NacosException {
        Properties properties = new Properties();
        properties.setProperty("serverAddr","127.0.0.1:8848");
        //核心接口
        NamingService naming = NamingFactory.createNamingService(properties);
        //服务注册
        naming.registerInstance("mall-user","192.168.0.1",8088,"TEST1");

        System.out.println(naming.getAllInstances("mall-user"));
    }
}
